package Hilfsklassen;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;


public class GUIKarte extends JButton implements MouseListener {

	public static final int STANDARD_BREITE = 100;
	public static final int STANDARD_HOEHE = 150;
	private String wert;		// Farbe resp. Wert
	private double smog;
	
	public GUIKarte(String wert)
	{
		this.addMouseListener(this);
		this.setMargin(new Insets(0,0,0,0));
		this.setIconTextGap(0);
		this.setBorderPainted(false);
		
		this.wert = wert;
		this.setPreferredSize(new Dimension(STANDARD_BREITE, STANDARD_HOEHE));
		this.setSize(new Dimension(STANDARD_BREITE, STANDARD_HOEHE));
		// Lade Bild und setze es
		Image standardIcon = Toolkit.getDefaultToolkit().getImage("Images/" + wert + ".png").getScaledInstance(STANDARD_BREITE, STANDARD_HOEHE, Image.SCALE_SMOOTH);
		Image rolloverIcon = Toolkit.getDefaultToolkit().getImage("Images/" + wert + "R.png").getScaledInstance(STANDARD_BREITE, STANDARD_HOEHE, Image.SCALE_SMOOTH);
		this.setIcon(new ImageIcon(standardIcon));
		this.setRolloverIcon(new ImageIcon(rolloverIcon));
		
	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
	//	this.setBackground(Color.darkGray);
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	protected void paintComponent(Graphics g)
	{
		Graphics2D g2d = (Graphics2D)g;
//		g2d.rotate(smog += 0.01);
//		g2d.setColor(Color.GRAY);
	//	g.fillRoundRect(0, 0, STANDARD_BREITE, STANDARD_HOEHE, 10, 10);
		g2d.setColor(Color.BLACK);
		g2d.drawRoundRect(0, 0, STANDARD_BREITE, STANDARD_HOEHE, 20, 20);
		getIcon().paintIcon(this, g, 0, 0);
		
	}
	
	
	
	
}
